{namespace lfe=SGalinski\Lfeditor\ViewHelpers}

<f:layout name="Default" />

<f:section name="selectItems">
	<f:render partial="SelectExtensionAndLanguageFile" arguments="{_all}" />
	<f:form id="mainMenuForm" action="changeSelection">
		<f:render partial="SelectConstant" arguments="{_all}" />
	</f:form>
</f:section>

<f:section name="main">
	<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}"
		and2="{constantSelection}" and3="{constantSelection} != '###default###'">
		<h2 class="uppercase">
			<f:translate key="function.const.edit.edit" />
		</h2>
		<f:form id="contentForm" action="editConstantSave">
			<div class="tx-lfeditor-buttons">
				<f:form.submit id="tx-lfeditor-button-submit" value="{f:translate(key:'button.save')}" />
			</div>

			<f:for each="{languages}" key="lang" as="constValue" iteration="iterator">
				<fieldset class="tx-lfeditor-fieldset bgColor5 {f:if(condition: iterator.isEven, then: 'tx-lfeditor-fright', else: 'tx-lfeditor-fleft')}">
					<legend class="bgColor3">
						{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}
					</legend>
					<lfe:extendedIf condition="{lang} == {defaultLanguage}" and="{defaultLanguagePermission} != 1">
						<f:then>
							<f:form.textarea
								cols="80" rows="{numTextAreaRows}"
								value="{constValue}"
								name="editConstTextArea[{lang}][{constantSelection}]"
								lang="{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}"
								additionalAttributes="{readonly: ''}"
								class="tx-lfeditor-textarea" />
						</f:then>
						<f:else>
							<f:form.textarea
								cols="80" rows="{numTextAreaRows}"
								value="{constValue}"
								name="editConstTextArea[{lang}][{constantSelection}]"
								lang="{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}"
								class="tx-lfeditor-textarea" />
						</f:else>
					</lfe:extendedIf>
				</fieldset>
			</f:for>

			<div class="tx-lfeditor-buttons">
				<f:form.submit value="{f:translate(key:'button.save')}" />
			</div>
		</f:form>
	</lfe:extendedIf>
</f:section>